﻿/*
 * Last review by   : Yaser
 * Last review date : JUL-21-09
 */
using System;

namespace ERP.Business.DataTypes.Employee.Attendance.Vacations
{
    /// <summary>
    /// Vacation
    /// </summary>
    [System.Runtime.Serialization.DataContract]
    [Serializable]
    [System.Runtime.Serialization.KnownType(typeof(Vacation))]
    public class Vacation : BaseTypes.BaseType
    {
        #region Properties

        /// <summary>
        /// Start Date
        /// </summary>
        /// <value>The start date.</value>
        [System.Runtime.Serialization.DataMember]
        public DateTime StartDate
        {
            get;
            set;
        }

        /// <summary>
        /// End Date
        /// </summary>
        /// <value>The end date.</value>
        [System.Runtime.Serialization.DataMember]
        public DateTime EndDate
        {
            get;
            set;
        }

        /// <summary>
        /// Actual Returning Date
        /// </summary>
        /// <value>The actual returning date.</value>
        [System.Runtime.Serialization.DataMember]
        public DateTime ActualReturningDate
        {
            get;
            set;
        }

        /// <summary>
        /// Type <see cref="VacationType"/>
        /// </summary>
        /// <value>The type.</value>
        [System.Runtime.Serialization.DataMember]
        public VacationType Type
        {
            get;
            set;
        }

        /// <summary>
        /// Status <see cref="VacatioStatus"/>
        /// </summary>
        /// <value>The status.</value>
        [System.Runtime.Serialization.DataMember]
        public VacatioStatus Status
        {
            get;
            set;
        }

        /// <summary>
        /// Notes
        /// </summary>
        /// <value>The notes.</value>
        [System.Runtime.Serialization.DataMember]
        public string Notes
        {
            get;
            set;
        }

        /// <summary>
        /// Offered Date
        /// </summary>
        /// <value>The offered date.</value>
        [System.Runtime.Serialization.DataMember]
        public DateTime OfferedDate
        {
            get;
            set;
        }

        /// <summary>
        /// Days Count
        /// </summary>
        /// <value>The days count.</value>
        [System.Runtime.Serialization.DataMember]
        public float DaysCount
        {
            get;
            set;
        }

        /// <summary>
        /// Paid Period
        /// </summary>
        /// <value>The paid period.</value>
        [System.Runtime.Serialization.DataMember]
        public float PaidPeriod
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the un paid period.
        /// </summary>
        /// <value>The un paid period.</value>
        [System.Runtime.Serialization.DataMember]
        public float UnPaidPeriod
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a value indicating whether [deduction flag].
        /// </summary>
        /// <value><c>true</c> if [deduction flag]; otherwise, <c>false</c>.</value>
        [System.Runtime.Serialization.DataMember]
        public bool DeductionFlag
        {
            get;
            set;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
        /// </summary>
        /// <param name="x">The first object to compare.</param>
        /// <param name="y">The second object to compare.</param>
        /// <returns>
        /// A signed integer that indicates the relative values of <paramref name="x"/> and <paramref name="y"/>, as shown in the following table.Value Meaning Less than zero <paramref name="x"/> is less than <paramref name="y"/>. Zero <paramref name="x"/> equals <paramref name="y"/>. Greater than zero <paramref name="x"/> is greater than <paramref name="y"/>.
        /// </returns>
        /// <exception cref="T:System.ArgumentException">Neither <paramref name="x"/> nor <paramref name="y"/> implements the <see cref="T:System.IComparable"/> interface.-or- <paramref name="x"/> and <paramref name="y"/> are of different types and neither one can handle comparisons with the other. </exception>
        public override int Compare(object x, object y)
        {
            if (ERP.Framework.Components.Utilities.ComparingHelper.ComapringManager.CompareTypes(x, y))
                return ((Vacation)x).EndDate.CompareTo(((Vacation)y).EndDate);
            return -1;
        }

        #endregion
    }
}
